<title>项目详情</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="#(assets)/css/weui2.css"/>
<script src="#(assets)/js/zepto.min.js"></script>
<script src="#(assets)/js/fx.js"></script>
<style>
	body{background:#FFF;margin:0;padding:0}
	a{color:#000}
</style>
#@checkToken()
<div style="height:50px;background:#FFF;width:100%">
	<div id="activedetail" onclick="window.location.href='/app/page/invest-activedetail'" align="center" style="color:#fa3048;font-size:14px;margin:0 6% 0 8%;width:20%;border-bottom:2px solid #fa3048;height:48px;float:left;line-height:50px">
		活动信息
	</div>
	<div id="certdetail" onclick="window.location.href='/app/page/invest-certdetail'" align="center" style="color:#656565;font-size:14px;margin:0 6% 0 6%;width:20%;height:48px;float:left;line-height:50px">
		证件信息
	</div>
	<div id="contractdetail" onclick="window.location.href='/app/page/invest-contractdetail'" align="center" style="color:#656565;font-size:14px;margin:0 8% 0 6%;width:20%;height:48px;float:left;line-height:50px">
		合同信息 
	</div>   
</div>
<div style="width:100%;font-size:14px">
	<div id="name" style="height:40px;line-height:40px;padding-left:15px;background:#f2f6f9">biaoti</div>
	<div style="width:100%;background:#FFF;height:278px;">
		<div style="height:30px;line-height:30px;border-bottom:1px solid #F0F0F0;">
			<a style="margin-right:20px;margin-left:15px;">项目总额</a><a id="amount">10000</a>(元)
		</div>
		<div style="height:30px;line-height:30px;border-bottom:1px solid #F0F0F0;">
			<a style="margin-right:20px;margin-left:15px;">剩余可投</a><a id="shengyu">10000</a>(元)
		</div>
		<div style="height:30px;line-height:30px;border-bottom:1px solid #F0F0F0;">
			<a style="margin-right:20px;margin-left:15px;">预期年化</a><a id="ratas">10000</a>
		</div>
		<div style="height:30px;line-height:30px;border-bottom:1px solid #F0F0F0;">
			<a style="margin-right:20px;margin-left:15px;">投资期限</a><a id="day_limit"></a>
		</div>
		<div style="height:30px;line-height:30px;border-bottom:1px solid #F0F0F0;">
			<a style="margin-right:20px;margin-left:15px;">起投时间</a><a id="start_time"></a>
		</div>
		<div style="height:30px;line-height:30px;border-bottom:1px solid #F0F0F0;">
			<a style="margin-right:20px;margin-left:15px;">截止时间</a><a id="end_time"></a>
		</div>
		<div style="height:30px;line-height:30px;border-bottom:1px solid #F0F0F0;">
			<a style="margin-right:20px;margin-left:15px;">起息时间</a><a>项目成立日</a>
		</div>
		<div style="height:30px;line-height:30px;border-bottom:1px solid #F0F0F0;">
			<a style="margin-right:20px;margin-left:15px;">还款方式</a><a id="repay_type">10000</a>
		</div>
		<div style="height:30px;line-height:30px;border-bottom:1px solid #F0F0F0;">
			<a style="margin-right:20px;margin-left:15px;">起购金额</a><a id="unit_amount">10000</a>
		</div>
	</div>
	<div style="height:10px;background:#f2f6f9"></div>
	<div id="activeinfo" style="padding-left:15px;">
		11111111
	</div>
</div> 
<script>
$(document).ready(function(){
	var id = GetRequest()["id"];
	var rates = 0;
	var amounts = 0;
	var times = 0;
	console.log(id);
	var url ="#(path)/bid/info?id="+id;
	$.getJSON(url, function(data) {
		var iteminfo = data.data.item;
		var detailinfo = data.data.detail;
		console.log(data);
		$("#activeinfo").html(detailinfo.project_info);
		$("#amount").html(iteminfo.amount); 
		var shengyu = iteminfo.amount - iteminfo.avunit * iteminfo.unit_amount;
		$("#shengyu").html(shengyu);
		$("#ratas").html(iteminfo.rate + "% + " + iteminfo.plus_rate + "%");
		$("#day_limit").html(iteminfo.day_limit + "天");
		$("#start_time").html(iteminfo.start_time);
		$("#end_time").html(iteminfo.end_time);
		$("#unit_amount").html(iteminfo.unit_amount + "(天)");
		$("#name").html(iteminfo.name);
		if(iteminfo.repay_type=="all"){
			$("#repay_type").html("一次还本付息");
		}
		if(iteminfo.repay_type=="schedule"){
			$("#repay_type").html("按期付息到期还本");
		}
		if(iteminfo.repay_type=="interest"){
			$("#repay_type").html("等额本息");
		}
		if(iteminfo.repay_type=="capital"){
			$("#repay_type").html("等额本金");
		}
		//一次还本付息 all 按期付息到期还本 schedule 等额本息 interest 等额本金 capital
		
	});
	$("#activedetail").click(function(){
		window.location.href="#(path)/app/page/invest-activedetail?id="+id;
	});
	$("#certdetail").click(function(){
		window.location.href="#(path)/app/page/invest-certdetail?id="+id;
	});
	$("#contractdetail").click(function(){
		window.location.href="#(path)/app/page/invest-contractdetail?id="+id;
	}); 
	function GetRequest() {   
	   var url = location.search; //获取url中"?"符后的字串  
	   var theRequest = new Object();  
	   if (url.indexOf("?") != -1) {  
		  var str = url.substr(1);  
		  strs = str.split("&");  
		  for(var i = 0; i < strs.length; i ++) {  
			 theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);  
		  }  
	   }  
	   return theRequest;  
	}  
	
});
</script>
	
	
	

	
</body>